package com.nbsaas.boot.tech.rest.convert;

import com.nbsaas.boot.tech.data.entity.Technology;
import com.nbsaas.boot.tech.api.domain.response.TechnologyResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;
/**
* 技术-实体对象转化成响应对象
*/

public class TechnologyResponseConvert  implements Converter<TechnologyResponse,Technology> {

    @Override
    public TechnologyResponse convert(Technology source) {
        TechnologyResponse  result = new  TechnologyResponse();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getCreator()!=null){
                        result.setCreator(source.getCreator().getId());
                    }

                    try {
                        if(source.getCreator()!=null){
                            result.setCreatorName(source.getCreator().getName());
                        }
                    } catch (Exception ignored) { }

        return result;
    }

}

